#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "color.h"

#define NUM 102

int main()
{
    char bar[NUM];
    memset(bar, 0 ,sizeof(bar));
    const char *lable="|/-\\"; //4符号
    int cnt = 0;
    while(cnt <= 100)
    {
        int c = cnt % 5;
        switch(c)
        {
            case 0:
                printf(RED);
                break;
            case 1:
                printf(GREEN);
                break;
            case 2:
                printf(BLUE);
                break;
            case 3:
                printf(YELLOW);
                break;
            case 4:
                printf(BROWN);
                break;
        }

        printf("[%-100s][%d%%] %c\r", bar, cnt, lable[cnt%4]);
        bar[cnt++] = '=';
        fflush(stdout);
        usleep(30000);
    }
    printf("\n");
    return 0;
}
